package exchange.fulltest;


import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.SocketException;

public class NetClientSocketReader implements Runnable {
	private ObjectInputStream in;
	private String answer;
	private boolean isSocketIsOpen;

	public NetClientSocketReader(ObjectInputStream in) {
		this.in = in;
		isSocketIsOpen = true;
	}

	@Override
	public void run() {
		while (isSocketIsOpen) {
			try {
				answer = (String) in.readObject();
				System.out.println("server>" + answer);

			} catch (SocketException socketeExc) {
				isSocketIsOpen = false;
				System.out.println("client>socket is cl0sed");
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}